function isType(type) {
	return function (obj) {
		return Object.prototype.toString.call(obj) === "[object " + type + "]";
	};
}
exports.isNumber = isType("Number");
exports.isObject = isType("Object");
exports.isArray = Array.isArray || isType("Array");
exports.isFunction = isType("Function");
exports.isNull = isType("Null");
exports.isUndefined = isType("Undefined");
exports.isString = isType("String");

exports.isEmail = function (email) {
	return /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i.test(email);
};

exports.isMobile = function (mobile) {
	return /^[1][3,4,5,7,8][0-9]{9}$/.test(mobile);
};

exports.isIdCard = function (idcard) {
	return /\d{15}|\d{18}/.test(idcard);
};

exports.isURL = function (url) {
	return /(https?|ftp|file):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/.test(url);
};

exports.isCN = function (cn) {
	return /[\u4E00-\u9FA5]/.test(cn);
};

exports.isZipCode = function (zipCode) {
	return /^[1-9]\d{5}$/.test(zipCode);
};

exports.isIP = function (ip) {
	return /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/.test(ip);
};
